/**
 *
 *  License: http://www.apache.org/licenses/LICENSE-2.0
 *  Home page: https://gitee.com/linlurui/service-abc
 *  Note: dto build on java, include the jdk1.8+ compiler symbol (and yes,
 *  I know the difference between language and runtime versions; this is a compromise).
 * @author linlurui
 * @Date Date: 2019-02-10
 */


package abc.model;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;


@Data
@Schema(description = "分页信息")
public class PageInfo implements Serializable {
    private static final long serialVersionUID = 101393572507513115L;
    @Schema(description = "页数")
    private long pageCount;
    @Schema(description = "当前页")
    private long pageIndex;
    @Schema(description = "每页记录数")
    private long pageSize;
    @Schema(description = "记录总数")
    private long totalRecords;

    @JsonIgnore
    public <T> IPage<T> getIPage() {
        return new Page(pageIndex, pageSize, totalRecords);
    }
}
